﻿@model MVC4.Presentation.Models.RegisterModel
@{
     int registerStatus = (int)ViewBag.registerStatus;
 }

<div id="signup-box" class="item  signup-box"   ng-class="{active: activePanel==2}">
	<div class="widget-body ">
		<div class="widget-main">
			<h4 class="header green lighter bigger">
				<i class="icon-group blue"></i>
				New User Registration
			</h4>

			 

			@using (Html.BeginForm("Register", "Account", new {  }, FormMethod.Post, new { name = "registerForm", novalidate = "" }))
   {
            @Html.AntiForgeryToken()
             
				<fieldset>
                     <div class="control-group "  ng-class="{error: (registerForm.Email.$error.required||registerForm.Email.$error.email) && registerModel.send}"       >
                        @Html.LabelFor(m => m.Email, new { @class = "control-label" })  
					<div class="controls">
						<span class="span11 input-icon input-icon-right">
                            <input class="span12 "     id="Email" name="Email"  ng-model="registerModel.Email" type="email" required />
							<i      ng-class="{true:'icon-remove-sign',false:'icon-envelope'  }[(registerForm.Email.$error.required||registerForm.Email.$error.email)&&registerModel.send]" ></i>
						</span>
						<span class="help-inline" ng-show="(registerForm.Email.$error.required||registerForm.Email.$error.email)&&registerModel.send">Something may have gone wrong   </span>
					</div>

				  </div>
					 <div class="control-group "  ng-class="{error: registerForm.UserName.$error.required && registerModel.send}"       >
                        @Html.LabelFor(m => m.UserName, new { @class = "control-label" })  
					<div class="controls">
						<span class="span11 input-icon input-icon-right">
                            <input class="span12 "     id="UserName" name="UserName"  ng-model="registerModel.UserName" type="text" required  />
							<i      ng-class="{true:'icon-remove-sign',false:'icon-user'  }[registerForm.UserName.$error.required&&registerModel.send]" ></i>
						</span>
						<span class="help-inline" ng-show="registerForm.UserName.$error.required&&registerModel.send">Something may have gone wrong   </span>
					</div>
				  </div> 
                 <div class="control-group " ng-class="{error: registerForm.Password.$error.required&&registerModel.send }">
                        @Html.LabelFor(m => m.Password, new { @class = "control-label" })
					<div class="controls">
						<span class="span11 input-icon input-icon-right">
                             <input class="span12"   id="Password" name="Password"  ng-model="registerModel.Password" type="password"  required />
                            <i     ng-class="{true:'icon-remove-sign',false:'icon-lock'  }[registerForm.Password.$error.required&&registerModel.send]"   ></i>
						</span>
                        <br />
                        <br />
						<div class="help-block"  ng-show="registerForm.Password.$error.required&&registerModel.send">Please correct the error  </div>
					</div>
				</div>
                    <div class="control-group " ng-class="{error: (registerForm.ConfirmPassword.$error.required||registerModel.ConfirmPassword!=registerModel.Password)&&registerModel.send}">
                        @Html.LabelFor(m => m.Password, new { @class = "control-label" })
					<div class="controls">
						<span class="span11 input-icon input-icon-right">
                             <input class="span12"   id="ConfirmPassword" name="ConfirmPassword"  ng-model="registerModel.ConfirmPassword" type="password"
                                   required   />
                            <i     ng-class="{true:'icon-remove-sign',false:'icon-lock'  }[(registerForm.ConfirmPassword.$error.required||registerModel.ConfirmPassword!=registerModel.Password)&&registerModel.send ]"   ></i>
						</span>
                        <br />
                        <br />
						<div class="help-block"  ng-show="(registerForm.ConfirmPassword.$error.required||registerModel.ConfirmPassword!=registerModel.Password) &&registerModel.send">Please correct the error  </div>
					</div>
				</div>
                    <div class="row-fluid">
					<label class="span8">
                            <input   id="UserAgreementConfirmed" name="UserAgreementConfirmed" type="checkbox"  ng-model="registerModel.UserAgreementConfirmed" value="{{loginModel.UserAgreementConfirmed}}">
							<span class="lbl">  I accept the
							    <a href="#">User Agreement</a>
							</span>
					</label>
					<button    class="span4 btn btn-small btn-primary" ng-click="submit(registerForm,$event,'registerModel',registerModel.ConfirmPassword==registerModel.Password)"  >
						<i class="icon-arrow-right icon-on-right"></i>
						Register  
					</button>
				</div>
                 <div class="alert alert-error" ng-show="(! registerForm.$valid||registerModel.ConfirmPassword!=registerModel.Password)&&registerModel.send">
					<button type="button" class="close" data-dismiss="alert">
						<i class="icon-remove"></i>
					</button>
					Change a few things up and try submitting again.
				</div>
                <div class="alert  " ng-class="{true:'alert-error',false:'alert-info'}[@registerStatus==0]"
                     ng-show="@registerStatus<2&&registerForm.$pristine">
					<button type="button" class="close" data-dismiss="alert">
						<i class="icon-remove"></i>
					</button>
					@ViewBag.registerMessage
				</div>
				</fieldset>
   }
		</div>

		<div class="toolbar center carousel-caption">
			<a href="#" onclick="$('#zCarousel').carousel('prev');return false;" class="back-to-login-link">
				<i class="icon-arrow-left"></i>
				Back to login
			</a>
		</div>
	</div><!--/widget-body-->
</div><!--/signup-box-->
